/* * Copyright © 2023 https://www.cestc.cn/ All rights reserved. */
package com.ffz.calcitesql.sqlparser;

import com.ffz.calcitesql.sqlparser.nodeparser.NodeParser;
import com.ffz.calcitesql.sqlparser.nodeparser.SelectNodeParser;
import org.apache.calcite.sql.SqlKind;

/**
 * sql解析器工厂类.
 *
 * @author fengfazheng
 * @since 2024/1/16 15:26
 */
public class SqlNodeParserFactory {
    private SqlNodeParserFactory() {
    }
    private static  class SingletonHolder{
        private static final SqlNodeParserFactory INSTANCE = new SqlNodeParserFactory();
    }
    public static SqlNodeParserFactory getInstance() {
        return SingletonHolder.INSTANCE;
    }

    public NodeParser getNodeParser(SqlKind sqlKind){
        switch (sqlKind){
            case SELECT:
            case ORDER_BY:
                return new SelectNodeParser();
            default:break;
        }
        throw new RuntimeException("暂不支持此种SQL解析");
    }

}
